<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.paimeng.bean.News_info" %>

<%
    List<News_info> arrlist = (List<News_info>)request.getAttribute("hotNews");
%>

<!doctype html>
<html>
    <head>
        <title>欢迎使用兔兔搜索</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="./javascript/jquery-3.2.1.min.js"></script>
        <script type="text/javascript" src="./javascript/keyword.js"></script>
        <link href="./css/search.css" rel="stylesheet" type="text/css">
        <style type="text/css">
         *{margin:0 auto}
         a{
             text-decoration:none;
             color: black;
             font-weight: normal;
         }
         a:hover{
             color: rgb(78,110,242);
         }
        </style>

        <script type="text/javascript">
            function a(){
            	var myDate = new Date();
            	var year = myDate.getFullYear();
            	var mon = myDate.getMonth()+1;
            	var day = myDate.getDay();
            	day = day - 1;
                $.ajax({
                    url:"searchHotNews?queryStr=2020&sortnews=byTime",//servlet文件的名称
                    type:"GET",
                    success: function(data){
                    	var obj = eval('(' + data + ')');
						var len = obj.length;
						var addStr = '<h3><a href="'+  obj[0].url +'" target="_blank">'+1+"、"+ obj[0].title +'</a></h3><br />'
                        for(var i=1;i<len;i++)
                        {
                            addStr += '<h3> <a href="'+ obj[i].url +'"target="_blank">'+(i+1)+"、"+ obj[i].title +'</a></h3><br />'
                        }
                    	document.getElementById("hotNews").innerHTML = addStr;
                    }
                });

            }
        </script>

    </head>
	<style>
		img.tutu{
			position: absolute;
			left: 1300px;
			top: 480px;
			width:180px;
		}
	</style>
    <body onload="a()" style="">
    	<section class="head-content" style="height:150px">
		</section>
		<img src="images/tutubojue.gif" class="tutu" alt="吉祥物">
        <!--start search-->
        <section class="main-content" >
			<div class="logo" style="text-align: center;">
				<span style="text-align: center;">欢迎使用兔兔搜索</span>
			</div>

			<div id="search_bg" style="margin-top:20px;margin-bottom:20px;">
			<div id="button_bg">
			    <form action="search" method="post">
			        <input type="text" value="" style="color:black;" x-webkit-speech="" lang="zh-CN" placeholder="点击搜索" name="queryStr" class="textb" autocomplete="off"><!--autocomplete 屏蔽输入自动记录-->
			            <input type="submit" name="sub" value="搜~一下" class="subb">
			        </form>
			        <div class="keyword"></div>
			    </div>
			</div>
		</section>
        <!--end start-->
        <div style="font-size: 12px; margin:0 auto; width:600px; height:100px; ">
			<br/>
			<br/>
			<h2>今日推荐</h2>
					 <!-- 数据开始 -->
			<br/>
			<br/>
			<div id="hotNews"></div>
            <div id="hotindex"></div>
		 </div>



    </body>
</html>
